package Model;

import util.TicTacToe_Exception;
import util.constants;
import util.player;

class board {
	
	public player[][] theboard;
	
	public board(){
		
		theboard = new player[constants.Board_Size][constants.Board_Size];
	}
	
	public void makeMove(int x, int y, player playerturn) throws TicTacToe_Exception{
		
		if(x>=constants.Board_Size){
			
			throw new TicTacToe_Exception("X index exceeds board size");
			
		}
		if(y>=constants.Board_Size){
			
			throw new TicTacToe_Exception("You may not make a move at that"+y+"because it exceeds max board size");
			
		}
		if(theboard[x][y]!=null){
			
			
			throw new TicTacToe_Exception("That space is taken");
			
		}
		
		theboard[x][y]=playerturn;
		
		//win conditions
		//if(theboard[0][0] && theboard[0][1] && theboard[0][2] == player.X || player.O){
			
		//	throw new TicTacToe_Exception("A Player has won!");
			
		//}
		
	}
	
	public void printboard(){
		
		for(int j=0; j<constants.Board_Size; j++){
			for(int i=0; i<constants.Board_Size; i++){
				if(theboard[i][j]!=null){
					System.out.print(theboard[i][j].toString());
				}else{
				System.out.print("_");
				

				
				}
			
			}
			System.out.println();
		}
		
	}
	
	
}
